package com.example.operation.controller;

import com.example.operation.domin.DecWaresImg;
import com.example.operation.service.DecWaresImgService;
import com.example.operation.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName: DecWaresImgController
 * @Description:
 * @Author
 * @Date 2021/11/29
 * @Version 1.0
 */


@Api(tags = "图片模块")
@RestController
@RequestMapping(value = "/decWaresImg")
public class DecWaresImgController {


    @Autowired
    private DecWaresImgService decWaresImgService;

    @ApiOperation(value = "图片上传请求接口")
    @PostMapping(value = "/save")
    public DecWaresImg save(@RequestBody MultipartFile img){
        return decWaresImgService.addpicture(img);
    }

    @ApiOperation(value = "图片删除请求接口")
    @DeleteMapping(value = "/delect")
    public Result<String> delect(@RequestParam(value = "id") Integer id){
        decWaresImgService.delete(id);
        return Result.ok("删除成功");
    }

}
